<script src="../js/equal.js"></script>
<script>
  class LexicallyBound {
    getFunction() {
      return () => {
        return new LexicallyBound()
      }
    }
    getArgumentsFunction() {
      return function () {
        return arguments
      }
    }
  }

  // 1
  {
    let bound = new LexicallyBound()
    let fn = bound.getFunction()
    console.assert(fn() === bound, `1. 不成立`)
  }
  // 2
  {
    let bound = new LexicallyBound()
    let anotherObj = {}
    let fn = bound.getFunction.call()
    console.assert(equal(fn.call(anotherObj), anotherObj), `2. 不成立`)
  }
  // 3
  {
    let bound = new LexicallyBound()
    let fn = bound.getArgumentsFunction()
    console.assert(fn(1, 2).length === 0, `3. 不成立`)
  }
</script>
